package choreganizer.accounts;

/**
 * @version 1.0
 * @created 04-May-2007 7:45:45 PM
 */
public abstract class ScheduleFactory {
    
    // Enumeration of the different factories
    public enum FactoryType {GMail, HSQLDB};
    
    // Variables
    public ScheduleAccount _ScheduleAccount;
    public ScheduleWriter _ScheduleWriter;
    public ScheduleReader _ScheduleReader;
    public ScheduleCreatorDialog _ScheduleCreatorDialog; 
    
    /*
     * Abstract factory method; determines which factory to use based
     * on FactoryType parameter
     */
    public ScheduleFactory GetScheduleFactory(FactoryType fType)
	    throws IllegalArgumentException {
	if (fType == FactoryType.GMail) {
	    return new choreganizer.accounts.gmail.GMailFactory();
	} else if (fType == FactoryType.HSQLDB) {
	    return new choreganizer.accounts.hsqldb.HSQLDBFactory();
	}

	// Unsupported factory, throw exception
	throw new IllegalArgumentException("Unsupported FactoryType: " + fType);
    }

    public abstract ScheduleAccount GetScheduleAccount();

    public abstract ScheduleReader GetScheduleReader();

    public abstract ScheduleWriter GetScheduleWriter();

    public abstract ScheduleCreatorDialog GetScheduleCreatorDialog();
}
